class Admin::ReservationsController < ApplicationController
  
  layout 'admin'
  require_role 'admin'

  def edit
    @reservation = Reservation.find(params[:id])
  end
  
  def update
    @reservation = Reservation.find(params[:id])
    if @reservation.update_attributes(params[:reservation])
      redirect_to :action => 'index'
    else
      render :action => 'edit'
    end
  end
  
  def destroy
    @reservation = Reservation.find(params[:id])
    if @reservation.destroy
      flash[:success] = "Reservation destroyed"
    end
    redirect_to :action => 'index'
  end
  
  def index
    @reservations = Reservation.find(:all, :conditions => ['reservations.state = ?', 'paid'], :order => 'reservations.updated_at DESC', :include => [:post, :member])
  end
  
  
end